// 导入封装过的 axios 文件
// import request from '../utils/request';
import axios from '../utils/request';
import { service_url } from './service';

// 管理员登录
export const loginFn = (data = {}) => {
    return axios.post(`${service_url}/api/admin/signin`, data).then(response => response.data)
}
// 管理员注册
export const registerFn = (data = {}) => {
    return axios.post(`${service_url}/api/admin/signup`, data).then(response => response.data)
}
// 修改管理员信息
export const modifyAdminFn = (data = {}) => {
    return axios.post(`${service_url}/api/admin/modify_admin`, data).then(response => response.data)
}




// 获取所有用户数量
export const totalUserleFn = (data = {}) => {
    return axios.get(`${service_url}/api/user/total`, { params: data }).then(response => response.data)
}

// 获取用户列表
export const listUserFn = (data = {}) => {
    return axios.get(`${service_url}/api/admin/list_user`, { params: data }).then(response => response.data)
}

// 搜索用户
export const searchUserFn = (data = {}) => {
    return axios.get(`${service_url}/api/admin/search`, { params: data }).then(response => response.data)
}

// 删除用户
export const removeUserFn = (data = {}) => {
    return axios.post(`${service_url}/api/admin/remove_user`, data).then(response => response.data)
}

// 修改用户资料
export const modifyUserFn = (data = {}) => {
    return axios.post(`${service_url}/api/admin/modify`, data).then(response => response.data)
}

// 登记车辆入场信息
export const parkingRecordEnterFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingRecord/enter`, data).then(response => response.data)
}

// 登记车辆离场信息
export const parkingRecordLeaveFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingRecord/leave`, data).then(response => response.data)
}

// 获取所有停车记录
export const parkingRecordListFn = (data = {}) => {
    return axios.get(`${service_url}/api/parkingRecord/list`, { params: data }).then(response => response.data)
}

// 删除停车记录
export const parkingRecordremoveFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingRecord/remove`, data).then(response => response.data)
}


// 获取停车场信息
export const parkingLotInfoFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingLot/info`, data).then(response => response.data)
}

// 车辆入场，减少车位
export const parkingLotSubFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingLot/sub`, data).then(response => response.data)
}

// 车辆离场，增加车位
export const parkingLotAddFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingLot/add`, data).then(response => response.data)
}

// 设置停车场收入
export const parkingLotIncomeFn = (data = {}) => {
    return axios.post(`${service_url}/api/parkingLot/income`, data).then(response => response.data)
}

// 创建订单
export const feeRecordCreateFn = (data = {}) => {
    return axios.post(`${service_url}/api/feeRecord/create`, data).then(response => response.data)
}


// 获取订单信息
export const feeRecordModifyFn = (data = {}) => {
    return axios.post(`${service_url}/api/feeRecord/modify`, data).then(response => response.data)
}

// 获取订单信息
export const feeRecordRemoveFn = (data = {}) => {
    return axios.post(`${service_url}/api/feeRecord/remove`, data).then(response => response.data)
}

// 获取所有订单信息
export const feeRecordListFn = (data = {}) => {
    return axios.get(`${service_url}/api/feeRecord/list`, { params: data }).then(response => response.data)
}

// 获取所有车辆信息
export const vehicleListFn = (data = {}) => {
    return axios.get(`${service_url}/api/vehicle/list`, { params: data }).then(response => response.data)
}
// 删除车辆信息
export const vehicleRemoveFn = (data = {}) => {
    return axios.post(`${service_url}/api/vehicle/remove`, data).then(response => response.data)
}

// 图片上传以及识别
export const uploadVehicleNumFn = (data = {}) => {
    return axios.post(`${service_url}/ocr/preview`, data, {
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    }).then(response => response.data)
}